import argparse
import sys
import os


def platform_func():
    pf = sys.platform
    return pf


def hostname_func():
    ht = os.name
    return ht


parser = argparse.ArgumentParser(
    description='sum the integers at the command line')

parser.add_argument(
    # 'integers', metavar='int', nargs='+', type=int,
    'integers', nargs='+', type=int,
    help='an integer to be summed')

parser.add_argument(
    '--log', default=sys.stdout, type=argparse.FileType('w'),
    help='the file where the sum should be written')

parser.add_argument(
    '--pf',
    help='Get the platform or hostname')

parser.set_defaults(func=platform_func)

args = parser.parse_args()
print(args.platform())

args.log.write('%s' % sum(args.integers))
args.log.close()

print(args.func())
